package com.tutorialspoint1;

import org.aspectj.lang.annotation.*;

@Aspect
public class logging {
    @Pointcut("execution(* com.tutorialspoint1.*.*(..))")
    public void selectAll(){}

    @Before("selectAll()")
    public void beforeAdvice(){
        System.out.println("Student profile is going to setup.");
    }

    @After("selectAll()")
    public void afterAdvice(){
        System.out.println("Student profile has been setup.");
    }

    @AfterReturning(pointcut = "selectAll()", returning = "retVal")
    public void afterThrowingAdvice(Object retVal){
        System.out.println("Returning " + retVal.toString());
    }

    @AfterThrowing(pointcut = "selectAll()", throwing = "ex")
    public void afterThrowingAdvice(IllegalArgumentException ex){
        System.out.println("There has been an exception " + ex.toString());
    }
}
